<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       //1，替换字符 replace('被替换的字符'，'替换为的字符')  它只会替换第一个字符
        var str = 'andyany';
        console.log(str.replace('n','b'))
        while (str.indexOf('a') !== -1) {
            str = str.replace('a','p')
        };
        console.log(str);

        //2，字符转换为数组 split('分隔符 ')  前面学过join 把数组转换为字符串
        var str2 = 'red, pink, bule';
        console.log(str2.split(','));
        var str3 = 'red&pink&bule';
        console.log(str3.split('&'));  
    </script>
</body>
</html>